<template>
  <view class="TextAreaWrap" @click="clickHandler">
    <textarea
      :placeholder="placeholder"
      class="TextArea"
      :disabled="disabled"
      @input="inputHandler"
      :value="value"
    />
  </view>
</template>
<script lang="ts">
import Vue from '@/utils/Vue';

interface IData {}

export default Vue.extend({
  data(): IData {
    return {};
  },
  components: {},
  props: {
    placeholder: {
      type: String,
      required: false,
    },
    value: {
      type: String,
      required: false,
    },
    disabled: {
      type: Boolean,
      required: false,
    },
  },
  methods: {
    inputHandler(event: any) {
      this.$emit('input', event);
      this.$emit('update:value', event.detail.value);
    },

    clickHandler(event: any) {
      this.$emit('click', event);
    },
  },
});
</script>
<style lang="less" scoped>
.TextAreaWrap {
  flex-grow: 1;
  flex-shrink: 1;
  position: relative;
  height: 100px;
  .TextArea {
    border: 1px solid #666;
    height: 100%;
    width: 100%;
    padding: 5px 10px;
    font-size: 18px;
    outline: none;
  }

  .Icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
  }
}
</style>
